Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dancing-ruby Ctrl+C stop #735

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

tompng
Copy link
Member

@tompng tompng commented Oct 21, 2023

IRB has an easter egg

$ irb --noautocomplete
irb(main):001> RubyVM[PRESS TAB KEY]
easter egg ([:logo and :dancing] two patterns randomly)

Since reline 0.3.3, dancing ruby easter egg does not stop with CTRL+C because STDOUT is raw mode. I added STDOUT.cooked do end
(I think it's from ruby/reline#474, reline stopped changing raw-mode and cooked mode frequently while rendering)

Stopping dancing-ruby with CTRL+C will abort input to IRB.

if true
  RubyVM[PRESS TAB KEY] [CTRL+C] # The input `if true\n  RUBYVM` is cleared

To avoid it, I also added trap("SIGINT")

@tompng tompng marked this pull request as draft October 21, 2023 04:01
@tompng tompng force-pushed the dancing_easter_egg_stop_bugfix branch from 7f7dedb to fada641 Compare October 21, 2023 04:03
@tompng tompng marked this pull request as ready for review October 21, 2023 04:03
@tompng tompng force-pushed the dancing_easter_egg_stop_bugfix branch from fada641 to 2a47bb6 Compare October 21, 2023 04:20
Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@st0012 st0012 added the bug Something isn't working label Oct 21, 2023
@st0012 st0012 merged commit 802b1cb into ruby:master Oct 21, 2023
24 checks passed
@tompng tompng deleted the dancing_easter_egg_stop_bugfix branch October 21, 2023 12:58
matzbot pushed a commit to ruby/ruby that referenced this pull request Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants